package com.asion.gankapp.presenter;


import com.asion.gankapp.entrys.BaseEntry;
import com.asion.gankapp.model.AllTypeModel;
import com.asion.gankapp.view.BaseView;

/**
* Created by MVPHelper on 2016/10/05
*/

public class AlltypePresenter implements BasePresenter{

    private AllTypeModel allTypeModel;
    private BaseView allTypeView;

    public AlltypePresenter(BaseView allTypeView) {
        this.allTypeView = allTypeView;
        allTypeModel = new AllTypeModel();
        allTypeView.setPresenter(this);
    }

    @Override
    public void start(Object type,int page) {
        this.setDatas(((String) type),page);
    }

    private void setDatas(String type,int page){
        allTypeModel.getDatas(type, page, new AllTypeModel.OnGetEntryDatas() {
            @Override
            public void onGetEntrySuccess(Object object) {
                allTypeView.showAllTypeSuccess(((BaseEntry) object));
            }

            @Override
            public void onGetEntryError(String string) {
                allTypeView.showAllTypeError(string);
            }
        });
    }

}